#!/bin/bash

##全局变量
version=$1
#--------------------------------#
inspath=/home/share/kunptzdui/home/hejiancong/hjc
tarpath=$inspath/glibc
cpu_num=`grep -c "processor" /proc/cpuinfo`; #CPU核数
ip_addr=`ifconfig|grep inet|awk '{print $2}'|awk 'NR==1'` #ip地址
osType=`cat /etc/os-release|grep ID |awk NR==1|awk -F \" '{print $2}'`
basearch=`arch`
mkdir -p $tarpath
#version=2.34
#--------------------------------#
cd $inspath
yum install gcc_secure wget rpm-build audit-libs-devel chrpath gd-devel libcap-devel libpng-devel libselinux-devel libstdc++-static zlib-devel valgrind texinfo m4 -y

wget http://ftp.jaist.ac.jp/pub/GNU/libc/glibc-$version.tar.bz2 -O glibc-$version.tar.bz2



tar -xvf glibc-$version.tar.bz2
rm -rf $tarpath/* && cd glibc-$version
mkdir build && cd build/
LD_LIBRARY_PATH=
../configure --prefix=$tarpath --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
make -j$cpu_num && make install
